// src/api/safety/dashboard.api.ts

import { http } from "@/utils/http";

/** 检查汇总项 */
export interface InspectionSummaryItem {
  name: string;
  value: number;
  percent: string;
  data: number[];
}

/** 每周检查统计项 */
export interface WeeklyCheckItem {
  requireData: number[];
  questionData: number[];
}

/** 每周合规统计项 */
export interface WeeklyComplianceItem {
  week: string;
  percentage: number;
  duration: number;
  color: string;
}

/** 每日汇总项 */
export interface DailySummaryItem {
  id: number;
  date: string;
  totalCheckNum: number;
  qualifiedNum: number;
  qualifiedRate: number;
  reportNum: number;
  reformNum: number;
  reformOverNum: number;
}

/** 近期活动项 */
export interface RecentActivityItem {
  date: string;
  deptName: string | null;
  title: string;
  source: string;
}

/** 仪表盘汇总数据响应类型 */
export interface DashboardSummaryResponse {
  inspectionSummary: InspectionSummaryItem[];
  weeklyChecks: WeeklyCheckItem[];
  weeklyCompliance: WeeklyComplianceItem[];
  dailySummary: DailySummaryItem[];
  recentActivities: RecentActivityItem[];
}

/**
 * @description 获取仪表盘汇总数据
 */
export function getDashboardSummaryApi() {
  return http.request<ResponseData<DashboardSummaryResponse>>(
    "get",
    "/safety/dashboard/summary"
  );
}
